<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>@yield('title', '') - {{getenv('APP_NAME')}} - 用户中心</title>
  <link rel="stylesheet" type="text/css" href="/assets/css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="/assets/fonts/line-icons.css">
  <link rel="stylesheet" href="/assets/plugins/morris/morris.css">
  <link rel="stylesheet" type="text/css" href="/assets/css/main.css">
  <link rel="stylesheet" type="text/css" href="/assets/css/responsive.css">
  <link rel="stylesheet" type="text/css" href="/assets/css/colorpicker.css">
  @yield('style')
</head>

<body>
  <div class="app header-default side-nav-dark">
    <div class="layout">
      @include('users._header')
      <!--左侧导航-->
      @include('users._left_menu')
      <div class="page-container">
        <div class="main-content">
          @include('shared._messages')
          @yield('content')
        </div>
        <footer class="content-footer">
          <div class="footer">
            <div class="copyright">
              <span>Copyright © 2018-2019 <b class="text-dark">ZhuanFa</b>. All Right Reserved
            </div>
          </div>
        </footer>
      </div>
    </div>
  </div>
  <div id="preloader">
    <div class="loader" id="loader-1"></div>
  </div>
  <script src="/assets/js/jquery-min.js"></script>
  <script src="/assets/js/popper.min.js"></script>
  <script src="/assets/js/bootstrap.min.js"></script>
  <script src="/assets/js/jquery.app.js"></script>
  <script src="/assets/js/main.js"></script>
  <!--script src="/assets/plugins/morris/morris.min.js"></script-->
  <script src="/assets/plugins/raphael/raphael-min.js"></script>
  <script src="/assets/js/bootstrap-colorpicker.min.js"></script>
  <!--script src="/assets/js/dashborad1.js"></script-->
  <script>
    $(function(){
      $('.color-picker').colorpicker();
      $('.color-picker').on('change', function (event) {
          console.log(event);
          //$(this).css('background-color', event.color.toString());
          //$(this).css('color', '#fff');
          $(this).val(event.color.toString());
          var id = event.target.dataset.id;
          var type = event.target.dataset.type;
          var method = event.target.dataset.method;
          if(app) {
            if(method == 'update') {
              for(var i = 0; i< app.ads.length; i++){
              if (app.ads[i] .id == id) {
                if (type == 'color') app.ads[i] .color = event.color.toString();
                else app.ads[i] .border_color = event.color.toString();
              }
              }
            } else if (method == 'create')  {
              for(var i = 0; i< app.add_ads.length; i++){
              if (app.add_ads[i] ._id === id) {
                  console.log('相等')
                  if (type == 'color') app.add_ads[i] .color = event.color.toString();
                  else app.add_ads[i] .border_color = event.color.toString();
                }
              }
            } else {
              $(this).css('background-color', event.color.toString());
            }

          }
      });
    })
  </script>
  @if (app()->isLocal())
    @include('sudosu::user-selector')
  @endif
  @yield('script', '')
</body>
</html>
